Glulx Text Effects by Emily Short
(For Glulx Only) Version 6
Gives control over text formatting in Glulx.
Chapter 1: Styles in Glulx
Chapter 2: Style features
Chapter 3: Defining styles
Chapter 4: Using the styles
Chapter 5: About this extension
Examples
A — Gaudy
B — The Gallic War
Glulx Text Effects provides an easy way to set up special text effects for Glulx.
Chapter 1: Styles in Glulx
Unlike the Z-Machine, which allows arbitrary combinations of features (such as color and boldness) to be applied to text, Glulx requires the author to define and then use text styles.
There are eleven of these styles:
Table of styles
normal-style the style used for regular text italic-style used for italic text (this is what the "[italic type]" phrase uses) bold-style used for bold text (this is what the "[bold type]" phrase uses) fixed-letter-spacing-style used for monospaced text (this is what the "[fixed letter spacing]" phrase uses) alert-style used when printing an end of game message such as "*** You have died. ***" blockquote-style used for printing box quotations header-style used to print the title of the game input-style used for the player's own input note-style used for messages such as "[Your score has increased by one point.]" special-style-1 these two styles are not used by Inform, and you are free to use them for any purpose you want special-style-2
Additionally, when defining styles you can set "all-styles" which will define all eleven styles at once.
Chapter 2: Style features
Each text style has the following features:
Table of style features
background color specifies the background color of the text color specifies the color of the text itself fixed width a truth state (default: false). If true then the text will be displayed with a fixed width (monospace) font font weight specifies the weight of the font. Can be set to "light-weight", "regular-weight" (the default), or "bold-weight" indentation a number (default: 0) specifying the number of units of indentation for the whole block of text. Units are defined by interpreter, but are often equivalent to spaces first line indentation a number (default: 0) specifying additional indentation for the first line of the text block italic a truth state (default: false). If true then the text will be displayed in italics justification can be set to "left-justified", "center-justified", "right-justified", or "left-right-justified" for justified on the left and right (often called full justification) relative size a number (default: 0) specifying how many font sizes above or below the browser's default a style should be set to reversed a truth state (default: false). If true then the foreground and background colors of the text will be reversed. This is most commonly used for the status line
Not all interpreters support all of these features. Notably, Gargoyle does not support justification or font sizes. If the interpreter does not support one of the features it will just be quietly ignored.
Chapter 3: Defining styles
To define the features each style should have, add a table continuation to the Table of User Styles in your code. For example:
Table of User Styles (continued)
style name color italic relative size all-styles "#FF0000" true -- header-style "#0000FF" false 1 special-style-1 "#00FF00"
This definition table above will make everything red and italics, except for the title which will be blue and a size bigger. Special style 1 is set to green, but it won't be used without the author manually turning it on.
Your table continuation does not need to include every column in the Table of User Styles, nor does it need to define every style. You can also continue the table multiple times, and even define a style in multiple places; if you do then the definitions will be combined together. If you do not want to set a feature for a style you can leave it blank with "--".
Colors are defined by specifying a web (CSS) color in a text. Web colors specify the red/green/blue components of a color in hexadecimal, and a correctly specified color will be 6 characters long (with an optional # at the beginning.) Note that short (#000) web colors are not supported.
If you use a color many times you can define it as a text constant, and then use that in the table:
Red is always "#FF0000".
Table of User Styles (continued)
style name color special-style-1 red
Chapter 4: Using the styles
You may invoke the text styles by using the following phrases
Table of style phrases
normal-style "[roman type]" italic-style "[italic type]" bold-style "[bold type]" fixed-letter-spacing-style "[fixed letter spacing]" (Return to regular variable spaced type with either "[variable letter spacing]" or just "[roman type]") alert-style "[alert style]" blockquote-style "[blockquote style]" header-style "[header style]" input-style "[input style]" note-style "[note style]" special-style-1 "[special-style-1]", "[first special style]", or "[first custom style]" (there are multiple options to support older code) special-style-2 "[special-style-2]", "[second special style]", or "[second custom style]"
Chapter 5: About this extension
This extension was originally by Emily Short. Version 5 was rewritten by Dannii Willis.
The latest version of this extension can be found at <https://github.com/i7/extensions>. This extension is released under the Creative Commons Attribution licence. Bug reports, feature requests or questions can be made at <https://github.com/i7/extensions/issues>.
|
Example Gaudy A visually overpowering exercise in modifying all the built-in text styles. |
"Gaudy" Include Version 5 of Glulx Text Effects by Emily Short. Use scoring. Texty Room is a room. "This is a room of [bold type]bold[roman type] and [italic type]italic[roman type] texts as well as messages in [fixed letter spacing]fixed width[variable letter spacing] text." Table of User Styles (continued) Instead of waiting: Instead of jumping: Every turn: Test me with "z / z / z / jump". |
|
Example The Gallic War An excuse to print a large, fancily-formatted bit of text using custom styles. |